

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>表单组合</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/layuikn/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/layuikn/style/admin.css" media="all">
</head>

<style>
   .layui-form-checkbox{
        margin-top: 10px;
    }
    .inputBox{
       margin-top:10px;
       margin-right: 15px;
       display: inline-block;
    }
    .inputBox input{
        height: 26px;
    }
    .treatmentStatus,.treatment,.tumorDiagnosis,.differentiation,.differentiation1,.Feibie,.tumorBearing,.objective{
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }
</style>

<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header"><h2>疾病情况</h2></div>
        <div class="layui-card-body" style="padding: 15px;">
            <fieldset class="layui-elem-field" style="padding: 20px;">
                <legend style="font-size: 15px;">个人信息</legend>
                <div class="layui-row">
                    <div class="layui-col-md4">住院号：<span id="huanzhe_hospital_id"></span></div>
                    <div class="layui-col-md4">姓名：<span id="huanzhe_name"></span></div>
                    <div class="layui-col-md4">性别：<span id="huanzhe_gender"></span></div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-md4">科室：<span id="huanzhe_keshi"></span></div>
                    <div class="layui-col-md4">年龄：<span id="huanzhe_age"></span></div>
                    <div class="layui-col-md4">录入日期：<span id="huanzhe_created"></span></div>
                </div>
            </fieldset>
            <form class="layui-form" action="" lay-filter="component-form-group">
                <fieldset class="layui-elem-field" style="padding: 20px;"> 
                    <legend style="font-size: 15px;">疾病情况</legend>
                    <div class="layui-row">
                        <div style="font-weight: 600;">1、首次诊断日期</div>
                        <div class="layui-col-md12">
                            <div class="layui-col-md6">
                                <div class="layui-form-item">
                                    <div class="layui-input-block" style="margin-left: 50px;">
                                        <input value="{if isset($info['zddate'])}{$info['zddate']}{/if}" type="text" name="zddate"  readonly id="zddate" autocomplete="off" placeholder="请输入首次诊断日期"  style="width: auto;" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md6">
                                <div class="layui-form-item">
                                    <div class="layui-input-block riqi">
                                        <input hidden value="0" type="text" name="jutiriqibujide"  disabled>
                                        <input type="checkbox" name="qtDtae" lay-filter="qtDtae" value="" title="具体日期记不得了">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row" style="margin-top: 20px;">
                        <div style="font-weight: 600;">2、主要肿瘤诊断</div>
                        <div class="layui-col-md12" >
                            <div class="layui-input-block tumorDiagnosis" style="margin-left: 50px;" id="zyzlzd">
                                <input hidden value="" type="text" name="zhongliu_list" disabled>
                            </div>
                        </div>
                    </div>

                    <div class="layui-row" style="margin-top: 20px;">
                        <div style="font-weight: 600;">3、病理</div>
                        <div class="layui-col-md12">
                            <div class="layui-form-item">
                                <label class="layui-form-label" >影像学诊断</label>
                                <div class="layui-input-inline" style="width: 30%;">
                                    <input value="" type="text" name="bl_yingxiangxue"  autocomplete="off" placeholder="请输入影像学诊断" class="layui-input">
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    （填写）
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <label class="layui-form-label" style="width: 130px;">第一次诊断病理分期</label>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <div class="layui-input-block dycblfq" style="margin-left: 15px;">
                                            <input hidden value="" type="text" name="bl_binglifenqi_1"  disabled>
                                            <input type="checkbox" lay-filter="pathology" name="bl_binglifenqi" value="0" title="细胞">
                                            <input type="checkbox" lay-filter="pathology" name="bl_binglifenqi" value="1" title="组织" >
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" >病理学诊断</label>
                                        <div class="layui-input-inline" style="width: 60%;">
                                            <input value="" type="text" name="bl_binglizhenduan_1"  autocomplete="off" placeholder="请输入病理学诊断" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">
                                            （填写）
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md6">
                                    <label class="layui-form-label">pTNM分期</label>
                                    T
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="p_t_1" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    N
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="p_n_1" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    M
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="p_m_1" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-col-md6">
                                    <label class="layui-form-label">期别</label>
                                    <div class="layui-inline" style="width: 30%;">
                                        <select name="p_qibie_1">
                                            <option value="" selected="">请选择</option>
                                            <option value="Ⅰ">Ⅰ</option>
                                            <option value="Ⅱ">Ⅱ</option>
                                            <option value="Ⅲ">Ⅲ</option>
                                            <option value="Ⅳ">Ⅳ</option>
                                            <option value="未明确">未明确</option>
                                        </select>
                                    </div>
                                    <div class="layui-inline" style="width: 30%;">
                                        <input type="text" name="p_info_1" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-row" style="margin-top: 20px;">
                                <div class="layui-col-md6">
                                    <label class="layui-form-label">cTNM分期</label>
                                    T
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="c_t_1" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    N
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="c_n_1" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    M
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="c_m_1" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-col-md6">
                                    <label class="layui-form-label">期别</label>
                                    <div class="layui-inline" style="width: 30%;">
                                        <select name="c_qibie_1">
                                            <option value="" selected="">请选择</option>
                                            <option value="Ⅰ">Ⅰ</option>
                                            <option value="Ⅱ">Ⅱ</option>
                                            <option value="Ⅲ">Ⅲ</option>
                                            <option value="Ⅳ">Ⅳ</option>
                                            <option value="未明确">未明确</option>
                                        </select>
                                    </div>
                                    <div class="layui-inline" style="width: 30%;">
                                        <input type="text" name="c_info_1" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width: 90px;">
                                            肿瘤分化程度
                                        </label>
                                        <div class="layui-input-block differentiation" >
                                            <input hidden value="" type="text" name="bl_zhongliu_fenhua_1"  disabled>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-row">
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <label class="layui-form-label" style="width: 130px;">调查时病理分期</label>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <div class="layui-input-block dcsblfq" style="margin-left: 15px;">
                                            <input hidden value="" type="text" name="bl_binglifenqi_dc"  disabled>
                                            <input type="checkbox" lay-filter="dc_pathology" name="dc_binglifenqi" value="0" title="细胞">
                                            <input type="checkbox" lay-filter="dc_pathology" name="dc_binglifenqi" value="1" title="组织" >
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label">病理学诊断</label>
                                        <div class="layui-input-inline" style="width: 60%;">
                                            <input value="{if isset($info['bl_binglizhenduan'])}{$info['bl_binglizhenduan']}{/if}" type="text" name="bl_binglizhenduan_dc"  autocomplete="off" placeholder="请输入病理学诊断" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux">
                                            （填写）
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md6">
                                    <label class="layui-form-label">pTNM分期</label>
                                    T
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="p_t_dc" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    N
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="p_n_dc" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    M
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="p_m_dc" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-col-md6">
                                    <label class="layui-form-label">期别</label>
                                    <div class="layui-inline" style="width: 30%;">
                                        <select name="p_qibie_dc">
                                            <option value="" selected="">请选择</option>
                                            <option value="Ⅰ">Ⅰ</option>
                                            <option value="Ⅱ">Ⅱ</option>
                                            <option value="Ⅲ">Ⅲ</option>
                                            <option value="Ⅳ">Ⅳ</option>
                                            <option value="未明确">未明确</option>
                                        </select>
                                    </div>
                                    <div class="layui-inline" style="width: 30%;">
                                        <input type="text" name="p_m" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-row" style="margin-top: 20px;">
                                <div class="layui-col-md6">
                                    <label class="layui-form-label">cTNM分期</label>
                                    T
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="c_t_dc" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    N
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="c_n_dc" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                    M
                                    <div class="layui-input-inline" style="width: 20%;">
                                        <input type="text" name="c_m_dc" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-col-md6">
                                    <label class="layui-form-label">期别</label>
                                    <div class="layui-inline" style="width: 30%;">
                                        <select name="c_qibie_dc">
                                            <option value="" selected="">请选择</option>
                                            <option value="Ⅰ">Ⅰ</option>
                                            <option value="Ⅱ">Ⅱ</option>
                                            <option value="Ⅲ">Ⅲ</option>
                                            <option value="Ⅳ">Ⅳ</option>
                                            <option value="未明确">未明确</option>
                                        </select>
                                    </div>
                                    <div class="layui-inline" style="width: 30%;">
                                        <input type="text" name="c_info_dc" placeholder="" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-md12">
                                    <div class="layui-form-item">
                                        <label class="layui-form-label" style="width: 90px;">
                                            肿瘤分化程度
                                        </label>
                                        <div class="layui-input-block differentiation1" >
                                            <input hidden value="" type="text" name="bl_zhongliu_fenhua_dc"  disabled>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div class="row">
                        <div style="font-weight: 600;">4、荷瘤状态（可多选）</div>
                        <div class="layui-col-md12">
                            <div class="layui-input-block tumorBearing" >
                                <input hidden value="" type="text" name="heliu" value="" disabled>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div style="font-weight: 600;">5、患者已经接受的主要治疗（可多选）</div>
                        <div class="layui-col-md12">
                            <div class="layui-input-block treatment" >
                                <input hidden value="" type="text" name="zhiliao" value="" disabled>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div style="font-weight: 600;">6、患者目前的治疗状态（可多选）</div>
                        <div class="layui-col-md12">
                            <div class="layui-input-block treatmentStatus" >
                                <input hidden value="" type="text" name="zhiliao_state" value="" disabled>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div style="font-weight: 600;">7、费别</div>
                        <div class="layui-col-md12">
                            <div class="layui-input-block Feibie" >
                                <input hidden value="" type="text" name="feibie" value="" disabled>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div style="font-weight: 600;">8、营养支持（可多选）</div>
                        <div class="layui-col-md12">
                            <div class="layui-input-block yingyang" >
                                <input hidden value="" type="text" name="yingyang" value="" disabled>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 60px;">PN方式</label>
                                    <div class="layui-input-block PNfangshi" >
                                        <input hidden value="" type="text" name="pntype"  disabled>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 60px;">PN制剂</label>
                                    <div class="layui-input-block PNzhiji" >
                                        <input hidden value="" type="text" name="pnzhiji"  disabled>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 60px;">EN方式</label>
                                    <div class="layui-input-block ENfangshi" >
                                        <input hidden value="" type="text" name="entype"  disabled>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 60px;">EN方式</label>
                                    <div class="layui-input-block ENzhiji" >
                                        <input hidden value="" type="text" name="enzhiji"  disabled>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 70px;">营养支持量</label>
                                    <div class="layui-input-block yingyangzhichi" >
                                       
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div style="font-weight: 600;">9、患者目前的功能状态</div>
                      
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 70px;">活动选项：</label>
                                    <div class="layui-input-block hd_Option" >
                                   
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label" style="width: 70px;">进食选项：</label>
                                    <div class="layui-input-block js_Option" >
                                       
                                    </div>
                                </div>
                            </div>
                        </div>
                       
                    </div>
                    <div class="row">
                        <div style="font-weight: 600;">10、本次入院治疗目的（可多选）</div>
                        <div class="layui-col-md12">
                            <div class="layui-input-block objective" >
                                <input hidden value="" type="text" name="ruyuanmudi" value="" disabled>
                            </div>
                        </div>
                    </div>
                </fieldset>
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" lay-submit="" lay-filter="last">上一步</button>
                            <button class="layui-btn" lay-submit="" lay-filter="next">下一步</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>

</div>


<script src="__STATIC__/layuikn/layui/layui.js"></script>
<script>
    layui.config({
        base: '__STATIC__/layuikn/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
        ,ajaxData:'../extends/ajaxData'
        ,getOption:'../extends/getOption'
    }).use(['index', 'jquery', 'ajaxData', 'getOption', 'form', 'laydate'], function(){
        var $ = layui.$
            admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,ajaxData = layui.ajaxData
            ,getOption = layui.getOption
            ,form = layui.form
            ,zhiliao_text = []
            ,zhiliao_state_text = []
            ,ruyuanmudi_text = []
            //常规用法
            laydate.render({
                elem: '#zddate'
                ,type: 'datetime'
                ,trigger: 'click'
            });

        var option_all;
        $.ajax({
            type: "get",
            url: "{:url('option/all')}",
            data: "",
            async:false, 
            dataType: "json",
            success: function (response) {
                option_all = response;
            }
        });
        var pid = sessionStorage.getItem("pid")
        ajaxData.ajaxData('GET',"{:url('patient/info')}?pid=" + pid,{},function (back) {
            if(back.data){
                $('#huanzhe_hospital_id').html(back.data.hospital_id);
                $('#huanzhe_name').html(back.data.name);
                $('#huanzhe_gender').html(back.data.gender);
                $('#huanzhe_keshi').html(back.data.keshi);
                $('#huanzhe_age').html(back.data.age);
                $('#huanzhe_created').html(back.data.created);
            }
        });

        // 表单赋值
        ajaxData.ajaxData('GET',"{:url('jibing/info')}?pid=" + pid,{},function (back) {
            if(back.data){
                //back.data.xsh_q_baidanbai_dw = "" + back.data.xsh_q_baidanbai_dw
                //给表单赋值
                form.val("component-form-group", back.data);
                zhiliao_text = back.data.zhiliao_text
                zhiliao_state_text = back.data.zhiliao_state_text
                ruyuanmudi_text = back.data.ruyuanmudi_text
            }
            form.render();
        });
         // 初始化表单
        setTimeout(function(){
            var object  = ''
            // 具体记不得
            if($("input[name='zhongliu_list']").val() == 1){
                $(".riqi input[type='checkbox']").attr('checked','checked')
            }else{
                $(".riqi input[type='checkbox']").attr('checked',false)
            }
            // 肿瘤列表
            object = $("input[name='zhongliu_list']")
            initValue(object)
            // 第一次诊断病理分期
            initbl_binglifenqi_1Value()
            // 肿瘤分化程度 (需要单独处理)
            differentiationValue()
            // 调查时病理分期(需要单独处理)
            initbl_binglifenqi_dcValue()
            // 肿瘤分化程度 (需要单独处理)
            differentiation1Value()
            // 荷瘤状态
            object = $("input[name='heliu']")
            initValue(object)
            // 患者主要接受治疗
            textTreatmentValue()
            // 患者治疗状态
            textTreatmentStatusValue()
            // 费别
            object = $("input[name='feibie']")
            initValue(object)
            // 营养
            object = $("input[name='yingyang']")
            initValue(object)
            object = $("input[name='pntype']")
            initValue(object)
            object = $("input[name='pnzhiji']")
            initValue(object)
            object = $("input[name='entype']")
            initValue(object)
            object = $("input[name='enzhiji']")
            initValue(object)
          
            // 入院目的
            textObjectiveValue()
            // 文本
            textInputValue()
        },500)
        
        function textInputValue(){
            zhiliao_text.forEach((obj,idx) => {
                $('.input'+obj.id).val(obj.text)
            })
            zhiliao_state_text.forEach((obj,idx) => {
                $('.input'+obj.id).val(obj.text)
            })
            ruyuanmudi_text.forEach((obj,idx) => {
                $('.input'+obj.id).val(obj.text)
            })
        }

        function initbl_binglifenqi_1Value() {
           var param=$("input[name='bl_binglifenqi_1']").val(),checkBoxs = $(".dycblfq input[type='checkbox']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('checked','checked');
                        break;
                    }
                }
            }
            form.render('checkbox');
        }
        function initbl_binglifenqi_dcValue() {
           var param=$("input[name='bl_binglifenqi_dc']").val(),checkBoxs = $(".dcsblfq input[type='checkbox']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('checked','checked');
                        break;
                    }
                }
            }
            form.render('checkbox');
        }
        function differentiationValue() {
           var param=$("input[name='bl_zhongliu_fenhua_1']").val(),checkBoxs = $(".differentiation input[type='checkbox']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('checked','checked');
                        break;
                    }
                }
            }
            form.render('checkbox');
        }
        function differentiation1Value() {
           var param=$("input[name='bl_zhongliu_fenhua_dc']").val(),checkBoxs = $(".differentiation1 input[type='checkbox']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('checked','checked');
                        break;
                    }
                }
            }
            form.render('checkbox');
        }

        function initValue(object) {
            var param=object.val(),checkBoxs = $( "input[type='checkbox']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('checked','checked');
                        break;
                    }
                }
            }
            form.render('checkbox');
        }

        function initRadioValue(radioObj) {
            var param=$("input[name='cha_list']").val(),checkBoxs = $("input[type='radio']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('radio','checked');
                        break;
                    }
                }
            }
            form.render('radio');
        }
        // 带输入框
        function textTreatmentStatusValue() {
           var param=$("input[name='zhiliao_state']").val(),checkBoxs = $(".treatmentStatus input[type='checkbox']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('checked','checked');
                        $('.input'+array[i]).removeAttr('disabled')
                        break;
                    }
                }
            }
            form.render('checkbox');
        }
        function textTreatmentValue() {
           var param=$("input[name='zhiliao']").val(),checkBoxs = $(".treatment input[type='checkbox']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('checked','checked');
                        $('.input'+array[i]).removeAttr('disabled')
                        break;
                    }
                }
            }
            form.render('checkbox');
        }
        function textObjectiveValue() {
           var param=$("input[name='ruyuanmudi']").val(),checkBoxs = $(".objective input[type='checkbox']"), array = param.split(",");
            for (var i = 0; i < array.length; i++) {
                for (var j = 0; j < checkBoxs.length; j++) {
                    var checkbox = $(checkBoxs[j]);
                    if (checkbox.val() == array[i]) {
                        checkbox.attr('checked','checked');
                        $('.input'+array[i]).removeAttr('disabled')
                        break;
                    }
                }
            }
            form.render('checkbox');
        }
        










        var diagnosis = []
        option_all.forEach((item,index) => {
            if(item.name == "主要肿瘤诊断"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){
                           $('.tumorDiagnosis').append('<input type="checkbox" name="zyzlzd" lay-filter="zyzlzd" value=" '+ val.id +'" title=" '+ val.name + '">')
                           $('.tumorDiagnosis').append('<div  class="inputBox" ><input disabled type="text" class="'+'input'+val.id+' name=" '+'input'+val.id+'"  value="" title="'+ val.name +'"></div>')
                        
                        }else{
                            $('.tumorDiagnosis').append('<input type="checkbox" name="zyzlzd" lay-filter="zyzlzd" value=" '+ val.id +'" title=" '+ val.name + '">')
                        }
                        diagnosis.push(val) 
                    }
                });
                console.log(diagnosis)
            }
        });
        diagnosis.forEach(val =>{
            // console.log(val)   
        })
        // 肿瘤分化程度
        var differentiation = []
        option_all.forEach((item,index) => {
            if(item.name == "肿瘤分化程度"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){
                           $('.differentiation').append('<input type="checkbox" lay-filter="differentiation" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.differentiation1').append('<input type="checkbox" lay-filter="differentiationtow" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.differentiation').append('<input disabled type="text" class="'+'input'+val.id+' name=" '+'differentiation'+val.id+'"  value="" title="'+ val.name +'">')
                           $('.differentiation1').append('<input disabled type="text" class="'+'input'+val.id+' name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">')
                        
                        }else{
                            $('.differentiation').append('<input type="checkbox" lay-filter="differentiation" value="'+ val.id +'" title="'+ val.name +'">')
                            $('.differentiation1').append('<input type="checkbox" lay-filter="differentiationtow" value="'+ val.id +'" title="'+ val.name +'">')
                        }
                        
                        differentiation.push(val) 
                    }
                });

            }
        });
        // 荷瘤状态 tumorBearing
        var tumorBearing = []
        option_all.forEach((item,index) => {
            if(item.name == "荷瘤状态"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){

                        if(val.is_input == '1'){
                           $('.tumorBearing').append('<input type="checkbox" lay-filter="tumorBearing" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.tumorBearing').append('<input disabled type="text" class="'+'input'+val.id+' name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">')
                        
                        }else{
                            $('.tumorBearing').append('<input type="checkbox" lay-filter="tumorBearing" value="'+ val.id +'" title="'+ val.name +'">')
                        }
                        tumorBearing.push(val) 
                    }
                });

            }
        });
        // 主要疗程 treatment 
        var treatment = []
        option_all.forEach((item,index) => {
            if(item.name == "患者已经接受的主要治疗"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                       if(val.is_input == '1'){
                        $('.treatment').append('<input type="checkbox" lay-filter="treatment" value="'+ val.id +'" title="'+ val.name +'">') 
                        $('.treatment').append('<div  class="inputBox" ><input disabled type="text" class="'+'input'+val.id+' name=" '+'input'+val.id+'"  value="" title="'+ val.name +'"></div>')
                        
                       }else{
                        $('.treatment').append('<input type="checkbox" lay-filter="treatment" value="'+ val.id +'" title="'+ val.name +'">')
                       }
                        treatment.push(val) 
                    }
                });

            }
        });
        // 患者目前治疗状态 treatmentStatus
        var treatmentStatus = []
        option_all.forEach((item,index) => {
            if(item.name == "患者目前的治疗状态"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){
                           if(val.id != "246" && val.id != '248'){
                                $('.treatmentStatus').append('<input type="checkbox" lay-filter="treatmentStatus" value="'+ val.id +'" title="'+ val.name +'">')
                                $('.treatmentStatus').append('<div  class="inputBox" >第<input disabled style="width:60px;"  type="text" class="'+'input'+val.id+' name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">疗程</div>')
                           }else if(val.id == '246'){
                                $('.treatmentStatus').append('<input type="checkbox" lay-filter="treatmentStatus" value="'+ val.id +'" title="'+ val.name +'">')
                                $('.treatmentStatus').append('<div  class="inputBox" >第<input disabled style="width:60px;"  type="text" class="'+'input'+val.id+' name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">年</div>')
                            }else if(val.id == '248'){
                                $('.treatmentStatus').append('<input type="checkbox" lay-filter="treatmentStatus" value="'+ val.id +'" title="'+ val.name +'">')
                                $('.treatmentStatus').append('<div  class="inputBox" ><input disabled type="text" class="'+'input'+val.id+' name=" '+'input'+val.id+'"  value="" title="'+ val.name +'"></div>')
                            }
                        
                       }else{
                            $('.treatmentStatus').append('<input type="checkbox" lay-filter="treatmentStatus" value="'+ val.id +'" title="'+ val.name +'">')
                       }
                        
                        treatmentStatus.push(val) 
                    }
                });

            }
        });
        // 费别 Feibie
        var Feibie = []
        option_all.forEach((item,index) => {
            if(item.name == "费别"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){  
                           $('.Feibie').append('<input type="checkbox" lay-filter="Feibie" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.Feibie').append('<input type="text" disabled class="'+'input'+val.id+' name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">')
                        
                       }else{
                        $('.Feibie').append('<input type="checkbox" lay-filter="Feibie" value="'+ val.id +'" title="'+ val.name +'">')
                       }
                        
                        Feibie.push(val) 
                    }
                });

            }
        });
        // 营养 yingyang
        var yingyang = []
        option_all.forEach((item,index) => {
            if(item.name == "营养支持"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){  
                            $('.yingyang').append('<input type="checkbox" lay-filter="yingyang" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.yingyang').append('<input  disabled type="text" name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">')
                        
                        }else{
                            $('.yingyang').append('<input type="checkbox" lay-filter="yingyang" value="'+ val.id +'" title="'+ val.name +'">')
                        }
                        
                        yingyang.push(val) 
                    }
                });

            }
        });
        // pn方式 PNfangshi
        var PNfangshi = []
        option_all.forEach((item,index) => {
            if(item.name == "PN方式"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){  
                            $('.PNfangshi').append('<input type="checkbox" lay-filter="PNfangshi" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.PNfangshi').append('<input disabled type="text" name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">')
                        
                        }else{
                            $('.PNfangshi').append('<input type="checkbox" lay-filter="PNfangshi" value="'+ val.id +'" title="'+ val.name +'">')
                        }
                        yingyang.push(val) 
                    }
                });
            }
        });
        // pn制剂 PNzhiji
        var PNzhiji = []
        option_all.forEach((item,index) => {
            if(item.name == "PN制剂"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){  
                            $('.PNzhiji').append('<input type="checkbox" lay-filter="PNzhiji" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.PNzhiji').append('<input type="text" disabled name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">')
                        
                        }else{
                            $('.PNzhiji').append('<input type="checkbox" lay-filter="PNzhiji" value="'+ val.id +'" title="'+ val.name +'">')
                        }
                        PNzhiji.push(val) 
                    }
                });
            }
        });
         // en方式 ENfangshi
         var ENfangshi = []
        option_all.forEach((item,index) => {
            if(item.name == "EN方式"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){  
                            $('.ENfangshi').append('<input type="checkbox" lay-filter="ENfangshi" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.ENfangshi').append('<input type="text" disabled name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">')
                        
                        }else{
                            $('.ENfangshi').append('<input type="checkbox" lay-filter="ENfangshi" value="'+ val.id +'" title="'+ val.name +'">')
                        }
                        ENfangshi.push(val) 
                    }
                });
            }
        });
        // en制剂 ENzhiji
        var ENzhiji = []
        option_all.forEach((item,index) => {
            if(item.name == "EN制剂"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){  
                            $('.ENzhiji').append('<input type="checkbox" lay-filter="ENzhiji" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.ENzhiji').append('<input type="text" disabled name=" '+'input'+val.id+'"  value="" title="'+ val.name +'">')
                        
                        }else{
                            $('.ENzhiji').append('<input type="checkbox" lay-filter="ENzhiji" value="'+ val.id +'" title="'+ val.name +'">')
                        }
                        ENzhiji.push(val) 
                    }
                });
            }
        });
        //营养支持 yingyangzhichi 
        var yingyangzhichi = []
        option_all.forEach((item,index) => {
            if(item.name == "营养支持量"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        
                        //  $('.yingyangzhichi ').append('<input type="checkbox" lay-filter="yingyangzhichi " value="'+ val.id +'" title="'+ val.name +'">')  
                          $('.yingyangzhichi ').append('<input type="radio" lay-filter="yy_yingyangzhichi" name="yingyangliang" value="' + val.id+ '" title="' + val.name+ '">')                   
                        yingyangzhichi .push(val) 
                    }
                });
            }
        });
        //患者功能 hz_function 
        var hd_Option = []
        option_all.forEach((item,index) => {
            if(item.name == "患者目前的功能状态--活动选项"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        $('.hd_Option').append('<input type="radio" lay-filter="hd_Option" name="hdoptions" value="' + val.id+ '" title="' + val.name+ '">')                   
                        hd_Option.push(val) 
                    }
                });
            }
        });
        var js_Option = []
        option_all.forEach((item,index) => {
            if(item.name == "患者目前的功能状态--进食选项"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        $('.js_Option ').append('<input type="radio" lay-filter="js_Option" name="jsoptions" value="' + val.id+ '" title="' + val.name+ '">')                   
                        js_Option.push(val) 
                    }
                });
            }
        });
        // 住院目的 objective
        var objective = []
        option_all.forEach((item,index) => {
            if(item.name == "本次入院治疗目的"){
                option_all.forEach((val,idx) => {
                    if(item.id == val.pid){
                        if(val.is_input == '1'){  
                           $('.objective').append('<input type="checkbox" lay-filter="objective" value="'+ val.id +'" title="'+ val.name +'">')
                           $('.objective').append('<div class="inputBox"><input disabled type="text" class="'+'input'+val.id+' name=" '+'input'+val.id+'"  value="" title="'+ val.name +'"></div>')
                       }else{
                            $('.objective').append('<input type="checkbox" lay-filter="objective" value="'+ val.id +'" title="'+ val.name +'">')
                       }
                       objective.push(val) 
                    }
                });

            }
        });
        
        option_1 = getOption.option(option_all,'荷瘤状态');
        console.log(option_1)
        laydate.render({
            elem: '#birthday' //指定元素
        });

        laydate.render({
            elem: '#rydate' //指定元素
        });

        form.render(null, 'component-form-group');

        laydate.render({
            elem: '#LAY-component-form-group-date'
        });

        /* 自定义验证规则 */
        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '标题至少得5个字符啊';
                }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });
 
        //监听复选框
        form.on('checkbox(qtDtae)', function (data) {
            var number = $('input[name="jutiriqibujide"]'), value = data.value, array = number.val().split(",");
            if (data.elem.checked) { 
                number.val(1);
                $('input[name="zddate"]').val('')
                $('input[name="zddate"]').attr('disabled','disabled')
                
            } else {
                $('input[name="zddate"]').removeAttr('disabled')
                number.val(0);
                
            }
        });
        // 肿瘤列表
        form.on('checkbox(zyzlzd)', function (data) {
            var number = $('input[name="zhongliu_list"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) { 
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                    var inputVal= $('.input'+data.value).val()
                    }
                number.val(newnumber);
            }
        });
         // 第一次病理分析
         form.on('checkbox(pathology)', function (data) {
            var number = $('input[name="bl_binglifenqi_1"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
         // 调查病理分析
         form.on('checkbox(dc_pathology)', function (data) {
            var number = $('input[name="bl_binglifenqi_dc"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        // treatmentStatus
        form.on('checkbox(differentiation)', function (data) {
            var number = $('input[name="bl_zhongliu_fenhua_1"]'), value = data.value, array = number.val().split(",");
            if (data.elem.checked) {
                $('.input'+data.value).val('')
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        form.on('checkbox(differentiationtow)', function (data) {
            var number = $('input[name="bl_zhongliu_fenhua_dc"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        // tumorBearing
        form.on('checkbox(tumorBearing)', function (data) {
            var number = $('input[name="heliu"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        // treatment
        form.on('checkbox(treatment)', function (data) {
            var number = $('input[name="zhiliao"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
                $('.treatment .input'+data.value).change(function(){
                    var list = {"id":data.value,"text":$('.input'+data.value).val()}
                    zhiliao_state_text.push(list)
                })
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                zhiliao_state_text.forEach((list,index) => {
                    if(data.val == list.id){
                        zhiliao_text.split[index]
                    }
                })
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        // treatmentStatus 
        form.on('checkbox(treatmentStatus)', function (data) {
            var number = $('input[name="zhiliao_state"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                $('.treatmentStatus .input'+data.value).change(function(){
                    var list = {"id":data.value,"text":$('.input'+data.value).val()}
                    zhiliao_text.push(list)
                })
                number.val(number.val() + value + ",");
            } else {
                
                $('.input'+data.value).attr('disabled','disabled')
                zhiliao_text.forEach((list,index) => {
                    if(data.val == list.id){
                        zhiliao_text.split[index]
                    }
                })
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        // Feibie
        form.on('checkbox(Feibie)', function (data) {
            var number = $('input[name="feibie"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        // 营养 yingyang 
        form.on('checkbox(yingyang)', function (data) {
            var number = $('input[name="yingyang"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        // pn
        form.on('checkbox(PNfangshi)', function (data) {
            var number = $('input[name="pntype"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        form.on('checkbox(PNzhiji)', function (data) {
            var number = $('input[name="pnzhiji"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        // EN
        form.on('checkbox(ENfangshi)', function (data) {
            var number = $('input[name="entype"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        form.on('checkbox(ENzhiji)', function (data) {
            var number = $('input[name="enzhiji"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        form.on('checkbox(cha_list)', function (data) {
            var number = $('input[name="cha_list"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });
        // 营养支持
        form.on('radio(yy_yingyangzhichi)', function (data) {
            var number = $('input[name="yingyangliang"]'), value = data.value, array = number.val().split(",");
            if (data.elem.checked) {
                console.log(data)
                number.val(value);
            } else {
                number.val('');
            }
        });
        form.on('radio(hd_Option)', function (data) {
            var number = $('input[name="hdoptions"]'), value = data.value, array = number.val().split(",");
            if (data.elem.checked) {
                number.val(value);  
            } else {
                number.val('');
            }
        });
        form.on('radio(js_Option)', function (data) {
            var number = $('input[name="js_OptionInput"]'), value = data.value, array = number.val().split(",");
            if (data.elem.checked) {
                number.val(value);  
            } else {
                number.val('');
            }
        })
         // 进院目的
        form.on('checkbox(objective)', function (data) {
            var number = $('input[name="ruyuanmudi"]'), value = data.value, array = number.val().split(",");
            $('.input'+data.value).val('')
            if (data.elem.checked) {
                $('.objective .input'+data.value).change(function(){
                    var list = {"id":data.value,"text":$('.input'+data.value).val()}
                    ruyuanmudi_text.push(list)
                })
                $('.input'+data.value).removeAttr('disabled')
                number.val(number.val() + value + ",");
            } else {
                $('.input'+data.value).attr('disabled','disabled')
                ruyuanmudi_text.forEach((list,index) => {
                    if(data.val == list.id){
                        zhiliao_text.split[index]
                    }
                })
                var newnumber = "";
                for (var i = 0; i < array.length; i++) {
                    var str = array[i];
                    newnumber += (str != value && str != "" && str != null) ? str + "," : "";
                }
                number.val(newnumber);
            }
        });

        form.on('submit(last)',function(data){
            if(pid == 'null') return  false;
            window.location.href = "{:url('patient/show')}?id=" + pid;
            return  false;
        });
        // 表单提交
        form.on('submit(next)',function(data){
            if(pid){
                if(pid != ''){
                    url = "{:url('jibing/update',[])}?pid=" + pid;
                        data.field.pid = pid;
                    }
                    data.field.zhiliao_text = zhiliao_text
                    data.field.zhiliao_state_text = zhiliao_state_text
                    data.field.ruyuanmudi_text = ruyuanmudi_text
                    console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
                    // document.write(JSON.stringify(data.field))
                    ajaxData.ajaxData('POST', url, data.field,function (back) {
                    var msg = "修改成功";
                    if(back.code == 200){
                        window.location.href = "{:url('kspf/show',[])}";
                        // layer.msg(msg, { icon: 6, time: 1000 }, function () {
                        // });
                    }else{
                        layer.msg(back.msg, {icon: 5});
                    }
                });
                return false;
            }else{
                return false; //本地没有pid跳出程序
            }
           
             
        })
       

        /* 监听指定开关 */
        form.on('switch(component-form-switchTest)', function(data){
            layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });

       

        function ajaxGetOptionAll(callback) {
            $.ajax({
                type: 'GET',
                //contentType: "application/json",
                url: "{:url('option/all',[])}",
                async:false,
                dataType: 'json',
                data: {}, //请求的附加参数，用json对象
                success: function (res) {
                    callback(res)
                }
            });
        }
    });
</script>
</body>
</html>
